package com.rinlink.jbcodec.creator;

import com.alibaba.fastjson.JSONObject;
import com.rinlink.jbcodec.common.CreatorUtils;
import com.rinlink.jbcodec.common.MapUtils;
import com.rinlink.jbcodec.transform.Transform;

import java.nio.ByteBuffer;

public abstract class ByteBufferToNumberArrayCreator extends ByteBufferToObjectCreator {

    @Override
    protected  Transform create(JSONObject attr, ByteBuffer data, JSONObject t) {
        String order = MapUtils.getOrDefault(attr,"order","big_engine");
        int size = CreatorUtils.getArraySize(attr);
        return create(data,size,order);
    }

    public abstract Transform create(ByteBuffer buf,int size,String order);

}
